/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */




import java.io.File;
import java.util.*;
import java.io.BufferedReader;
import java.io.FileReader;

import commons.IOhandler;
import commons.DataProcessing;


/**
 *
 * @author TonyLogic
 */
/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */




import java.io.File;
import java.util.*;
import java.io.BufferedReader;
import java.io.FileReader;
import java.io.FileInputStream;

import commons.IOhandler;
import commons.DataProcessing;



/**
 *
 * @author TonyLogic
 */
public class SwitchBox {

    /**
     * @param args the command line arguments
     */
    
    
    public static void main(String[] args) {
        // TODO code application logic here

    	List<File> Files = new ArrayList<File>();
    	
    	File equivitalPath = null;
    	File PillTimeSchema = null;

    	if( System.getProperty("os.name").contentEquals("Linux")){
    		equivitalPath = new File("/media/trigon/HD-PCTU3/Switchbox/Equivital_core_patches");
    		PillTimeSchema = new File("/media/trigon/HD-PCTU3/Switchbox/Equivital_core_patches/Overzicht_pills+oplaadtijden_2.xls");
    			
    	}else{    
    		 equivitalPath = new File("F:/Switchbox/Equivital_core_patches");
    		PillTimeSchema = new File("F:/SwitchBox/Equivital_core_patches/Overzicht_pills+oplaadtijden_2.xls");
    	}
    
      //for( int xi=2;xi<145;xi++){
    	  
       String number =""+3; 
       System.out.println(number);
       String PatientNumber = DataProcessing.To3DigitString(number);
            
       IOhandler.searchForDatFiles(equivitalPath, Files,PatientNumber , false, true);
    
       List<File> aPatientEquivitalFiles = new ArrayList<File>();
    
       for (int i=0;i<Files.size();i++)
       {
    	      	   
    	 if(Files.get(i).getPath().substring(Files.get(i).getPath().length()-27,Files.get(i).getPath().length()-24 ) .contentEquals(PatientNumber)){
    	   
    	   //System.out.println(Files.get(i).getPath());
    	   aPatientEquivitalFiles.add(Files.get(i));
    	 }
    	  
       }
       
       DataProcessing.CleanEquivital(aPatientEquivitalFiles,equivitalPath,PillTimeSchema, 300, PatientNumber);
    	
     //}
      
    	
    	
    }
}
